package org.example.cicdi.service.impl.third.handlewebvo;


import org.example.codegenerate.modelext.WebVo.annotation.table.WVo;
import org.example.codegenerate.modelext.WebVo.domian.table.WebModelVo;

public class HandleWebVoV1 implements HandleWebVo{
    @Override
    public WebModelVo handleWebVo(Class<?> cl, WebModelVo model) {
        WVo vo = cl.getAnnotation(WVo.class);
        if (vo == null) {
            return model;
        }

        if (model == null) {
            model = new WebModelVo();
        }
        //为了保证不重复，将packagename加上了entityName
        //model.setPackageName(vo.packageName());
        /*if(vo.packageName().equalsIgnoreCase("")){
            //设置默认值
            model.setPackageName(cl.getSimpleName().toLowerCase());
        }else {
            model.setPackageName(vo.packageName());
        }*/
        if(vo.destinationOutPutDir().equalsIgnoreCase("")){
            model.setDestinationOutPutDir("D:\\eclipse2018-workspace\\jeecg-boot\\"+cl.getSimpleName().toLowerCase());
        }else {
            model.setDestinationOutPutDir(vo.destinationOutPutDir());
        }

        model.setFrontDestionOutPutDir(vo.frontDestionOutPutDir());

        model.setJformType(vo.jformType());
        model.setModeltype(vo.modeltype());
        model.setServicename(vo.servicename());

        return model;
    }
}
